<include file="Public:header" />
<div class="span-24 last">
    <include file="Public:menu" />
    <div class="span-19 last">
        <switch name="ACTION_NAME">
            <case value="add">
                <script type="text/javascript" src="__ROOT__/Public/Js/addInput/addInput.js"></script>
                <script type="text/javascript">
                    $(function(){
                        $("#addname").addinput({name: ["name[]"]});
                    });
                </script>
                <h4>添加分类</h4>
                <form name="catsform" id ="catsform" method="post" action="__URL__/doadd">


                    <table width="200" border="1">
                        <tr>
                            <th scope="col">父类</th>
                            <th scope="col">分类名</th>
                        </tr>
                        <tr>
                            <td>
                                <select  multiple="multiple" name="fatherid" style="height:400px">
                                    <volist name="categoty" id="data"  >
                                        <option value="{$key}">{$data}</option>
                                    </volist>
                                </select>
                            </td>
                            <td><ul id="addname"></ul><a href="#">+ 添加</a></td>
                        </tr>
                    </table>
                    <div align="center"><input type="submit" value="提交"  /></div>
                </form>

            </case>
            <case value="edit">
                <h4>编辑分类</h4>
                <form name="catsform" method="post" action="__URL__/doedit">
                    <table border="0" cellspacing="1" >
                        <tr>
                            <th>ID</th>
                            <td>{$cat_data.id}<input type="hidden" name="id" value="{$cat_data.id}"></td>
                        </tr>
                        <tr>
                            <th>父类</th>
                            <td>
                                <select name="fatherid" id="fatherid">
                                    <volist name="categoty" id="data"  >
                                        <option value="{$key}" <if condition="$key eq $cat_data.fatherid "> selected="selected" </if>>{$data}</option>
                                    </volist>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>分类名</th>
                            <td><input type="text" name="name" value="{$cat_data.name}"  /></td>
                        </tr>
                        <tr>
                            <th>分类拼音</th>
                            <td><input type="text" name="pinyin" value="{$cat_data.pinyin}"  /></td>
                        </tr>
                    </table>
                    <div align="center"><input type="submit" value="提交"  /></div>
                </form>
            </case>
            <default />
            <h4>总共{$catecount}个分类 <a href="__URL__/add">添加</a></h4>
            
            <form name="catsform" method="post" action="__URL__/batch">
                <table width="100%" border="0" cellspacing="1" >
                    <tr>
                        <th width="20"><input name="checkbox" type="checkbox"  onClick="selAll(this)" /></th>
                        <th width="30">ID</th>
                        <th>分类名</th>
                        <th>拼音</th>
                        <th width="50">父id</th>
                        <th width="50">排序</th>
                        <th width="150">操作</th>
                    </tr>
                    <volist name="categoty" id="data">
                        <if condition="$data.id neq '' ">
                            <tr align='center'>
                                <td><input name="id[]" type="checkbox" value="{$data.id}"  /></td>
                                <td>{$data.id}</td>
                                <td align="left"><a href='__URL__/edit/id/{$data.id}'><u>{$data.name}</u></a></td>
                                <td align="left"><a href='__URL__/edit/id/{$data.id}'><u>{$data.pinyin}</u></a></td>
                                <td>{$data.fatherid}</td>
                                <td><input size ="3" name="{$data.id}" value="{$data.orderid}" /></td>
                                <td><a href="__URL__/edit/id/{$data.id}">编辑</a> | <a href="__URL__/batch/act/delete/id/{$data.id}">删除</a></td>
                            </tr>
                        </if>
                    </volist>

                </table>
                            <input name="act" type="radio" value="delete" />删除
                            <input name="act" type="radio" value="editeorder" />编辑排序
                            <input name="act" type="radio" value="pinyin" />生成拼音
                            <input type="submit" value="提交"  />
            </form>
            
        </switch>
    </div>
    <div class="clear"></div>
</div>
<include file="Public:footer" />